<template>
  <div>
    <MyHeader title="tabBar案例" backgroundColor="red"></MyHeader>
    <div class="main">
      <component :is="comName"></component>
    </div>
    <MyTabBar :tabs="tabList" @changeBar="changeFn"></MyTabBar>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyTabBar from "./components/MyTabBar";
// 页面
import MyGoodsList from "./views/MyGoodsList";
import MySearch from "./views/MySearch";
import UserInfo from "./views/UserInfo";
export default {
  components: {
    MyHeader,
    MyTabBar,
    UserInfo,
    MyGoodsList,
    MySearch,
  },
  data() {
    return {
      tabList: [
        {
          iconText: "icon-shangpinliebiao",
          text: "商品列表",
          componentName: "MyGoodsList",
        },
        {
          iconText: "icon-sousuo",
          text: "商品搜索",
          componentName: "MySearch",
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "UserInfo",
        },
      ],
      comName: "MyGoodsList",
    };
  },
  methods: {
    changeFn(index) {
      this.comName = this.tabList[index].componentName;
    },
  },
};
</script>

<style scoped>
.main {
  padding: 2.813rem 0 3.125rem 0;
}
</style>

